package com.gitee.zeric.codec.constans;


import java.util.Objects;

/**
 * @author zj
 * @date 2021/12/15
 */
public enum CodeRuleTypeEnum {
    /**
     * 系统
     */
    SYSTEM("0", "系统"),
    /**
     * 业务
     */
    BUSINESS("1", "业务"),
    /**
     * 常量
     */
    CUS_CONSTANT("2", "常量");

    private String type;
    private String description;

    public static CodeRuleTypeEnum resolve(String type) {
        if (Objects.isNull(type)) {
            return null;
        } else {
            type = type.trim();
            CodeRuleTypeEnum[] var1 = values();
            int var2 = var1.length;

            for(int var3 = 0; var3 < var2; ++var3) {
                CodeRuleTypeEnum status = var1[var3];
                if (status.getType().equalsIgnoreCase(type)) {
                    return status;
                }
            }

            throw new IllegalArgumentException("No matching constant for [" + type + "]");
        }
    }

    public String getValue() {
        return this.type;
    }

    public String getLabel() {
        return this.description;
    }

    public String getType() {
        return this.type;
    }

    public String getDescription() {
        return this.description;
    }

    private CodeRuleTypeEnum(String type, String description) {
        this.type = type;
        this.description = description;
    }
}
